home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / mac / files / t_sys5 / unixcpio.gz / unixnet.cpio / mkdep (.txt) < prev    next >
Microsoft Windows Help File Content  |  1994-07-11  |  741b  |  30 lines

  1. # @(#) depend v1.0 Create a makefile of dependencies
  2. # Author: Jeffrey Kegler
  3. cpparg=
  4. linelen=60 # desired length of dependency line
  5. for arg in "$@"
  6.     case $arg in
  7.     -[CT] | -[UID]*) cpparg="$cpparg $arg"
  8.     esac
  9. for source in "$@"
  10.     target=`expr "$source" : '\\(.*\\)\\.c$'`
  11.     if [ -n "$target" ]; then
  12.         target=`basename "$target"`
  13.         /lib/cpp $cpparg "$source" |
  14.         sed -n -e 's/ 1$//' -e 's/^# 1 "\(.*\)"/\1/p' |
  15.         awk '
  16.             BEGIN { deplist = "'$target.o:'" }
  17.             NR > 1 {
  18.                 used++;
  19.                 if (length(deplist "\t" $0) >= '$linelen') {
  20.                     print deplist "\\"
  21.                     deplist = "\t" $0
  22.                 } else deplist = deplist "\t" $0
  23.             END {
  24.                 if (used)
  25.                 {
  26.                     if (deplist != "") print deplist
  27.                     print
  28.                 }
  29. exit 0
  30.